/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vadung.contragame2d;

import javax.microedition.lcdui.Graphics;

/**
 *
 * @author dung.voanh
 */
public abstract class State { 
    // Method
    public abstract void Init();
    public abstract void Update();
    public abstract void Render(Graphics g);
    public abstract void Exit();
    
    // Handle message of State 
    public final void HandleMessage(int message)
    {
        switch(message){
            case DEFINE.MESSAGE_INIT:
                Init();
                break;
            case DEFINE.MESSAGE_RENDER:
                Render(Midlet.s_canGame.getGraphics());
                break;
            case DEFINE.MESSAGE_UPDATE:
                Update();
                break;
            case DEFINE.MESSAGE_EXIT:
                Exit();
                break;
        }
    }
}
